<cpanel include="../../config.php">

<?

/***************************************************************************
 *                                 error_log.php
 *                            -------------------
 *   Begin                : Thursday, April 16, 2005
 *   Copyright            : (C) 2005 Point and Code
 *   Domain               : http://www.pointandcode.com/
 *   Email                : support@pointandcode.com
 *   Version              : 1.0.2
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

$html_root_path = '../../';
include $root_path.'common.php';
$page_title = $lang['error_log'];
include $root_path.'page_header.php';


$template->set_filenames(array(
	'body' => $root_path.$template_path.'stats/error_log.tpl')
);

$error_log = <<<EOFpacman
<cpanel Stats="errlog($CPDATA{'DNS'},/var/domlogs/$CPDATA{'DNS'}-error_log)">
EOFpacman;
$error_log = explode('<br />', nl2br($error_log));

$i = 0;
foreach ($error_log as $row) {

	$temp = explode('[', $row);
	$temp2 = explode(']', $temp[1]);
	$date = $temp2[0];
	$temp2 = explode(']', $temp[2]);
	$error = $temp2[0];
	
	$row = str_replace("[".$date."] [".$error."] ", '', trim($row));
	
	if (!empty($row)) {
		$template->assign_block_vars('errorlogrow', array(
			'ROWCLASS' => ($i%2) ? $template_cfg['class_row_1'] : $template_cfg['class_row_2'],
			'DATE' => $date,
			'ERROR' => $error,
			'ENTRY' => trim($row),
		));
	$i++;
	};
};


$template->assign_vars(array(
	'L_ERROR_LOG' => $lang['error_log'],
	'L_ERROR_LOG_INTRO' => $lang['error_log_intro'],
	'L_DATE' => $lang['date'],
	'L_ERROR_TYPE' => $lang['error_type'],
	'L_ENTRY' => $lang['entry'],
));

//
// Woohoo! All done!
//
$template->pparse('body');

include $root_path.'page_tail.php';


?>